import fetch from 'common/src/utils/fetch';
import UTILS from "common/src/utils/utils";
const api_name = 'api/compulsoryservice'
const group_name = 'stuAcademicAdvisingApplyInfo'

export function submit(data) {
  return fetch({
    url: '/api/compulsoryservice/stuAcademicAdvisingApplyInfo/submit',
    method: 'POST',
    data
  });
}

export function query(data) {
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingApplyInfo/query',
    method: 'POST',
    data
  });
}

export function detail(data) {
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingApplyInfo/getDetail?id='+data,
    method: 'GET'
  });
}

//导出
export function exportExcel(data) {
  return fetch({
      url: `api/compulsoryservice/stuAcademicAdvisingApplyInfo/export`,
      method: "POST",
      responseType: "blob",
      data
  }).then(res => {
      UTILS.downloadFile(
          res,
          "培养过程综合评价.xls",
          "application/vnd.ms-excel;charset=utf-8"
      );
  });
}

// 工作流 批量通过
export function workflowBatchPass(data) {
  return fetch({
      url: '/api/workflow/approval/through/batch',
      method: 'post',
      data: data
  })
}
// 工作流 批量驳回
export function workflowBatchReject(data) {
  return fetch({
      url: '/api/workflow/approval/reject/batch',
      method: 'post',
      data: data
  })
}

export function getSwitch(){
  return fetch({
    url: 'api/commonservice/commonparam/value/'+'thesis_symposium_apply_switch',
    method: 'GET'
  })
}

export function update(data){
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingApplyInfo/update',
    method: 'PUT',
    data
  })
}

export function batchReject(data){
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingApplyInfo/batchReject',
    method: 'PUT',
    data
  })
}

// 权限设置-查询当前生效的标准
export function querySetting() {
  return fetch({
      url: 'api/compulsoryservice/stuAcademicAdvisingSetting/query',
      method: 'get'
  })
}

// 权限设置-新增/编辑 标准
export function addOrUpdateSetting(data){
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingSetting/setting',
    method: 'post',
    data
  })
}

// 权限设置-学生提交申请/编辑 时校验是否符合生效标准
export function applyCheck(data){
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingSetting/applyCheck?studentNo=' + data,
    method: 'get'
  })
}

//培养过程综合评价查询-导出pdf接口（单个或批量）
export function queryExportPDF(data) {
  let param = JSON.stringify(data);
  window.open(`api/compulsoryservice/stuAcademicAdvisingApplyInfo/exportPdf?param=` + param);
}

// 培养过程综合评价-获取学生信息
export function getStuInfo(data){
  return fetch({
    url: 'api/compulsoryservice/stuAcademicAdvisingApplyInfo/getStuInfo?stuNo=' + data.stuNo + '&yearTerm=' + data.yearTerm,
    method: 'get'
  })
}
